package com.example.databindingdemo;

import android.app.Application;
import android.content.Context;

/**
 * 获取全局上下文对象
 * 还需要子在清单文件中配置一下该上下文对象的位置
 * android:name="com.example.databindingdemo.MyApplication"
 */
public class MyApplication extends Application {
    private static Context context;
    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
    }

    public static Context getContext() {
        return context;
    }
}
